// dlg.txt

begintalkscript;

variables;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(40,1) == 0;
	question = "special";
	text1 = "This broad, flat plain is mostly farmland, helping to feed Perikalia to the west. A river flows by to the south, and long trenches carry some water up to the rows of crops.";
	text2 = "The war has mostly kept its distance from Perikalia. There are no signs of battle. However, the creation infestations created by the rebels have managed to get a clawhold here.";
	text3 = "The rows of crops bear broad, bald patches where pests have torn into them. You are surrounded by areas where the ground has been torn up by the large, burrowing pests.";
	text4 = "The drakons have been merciless in their use of the Shaping arts. The Unbound are not the only creations they have released into Shaper lands to make life here a misery.";
	action = SET_SDF 40 1 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(40,2) == 0;
	question = "special";
	text1 = "These barracks are a home to several of the serviles who work in the fields. You could smell them well before you entered. They are a filthy mess.";
	text2 = "Serviles kept by the Shapers for menial labor are kept very simple. They need a human to take care of them. Otherwise, their homes become very filthy. The floor is a mess, and the cooking fire has been allowed to go out.";
	text3 = "Their Keeper is probably hiding inside Perikalia, in an effort to stay a safe distance from hostile bugs. It's a terrible dereliction of duty.";
	action = SET_SDF 40 2 1;

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The Shapers have left several creations here to guard Sage Rudelle. They must greatly value her work and not want it to be disturbed.";

begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The red goo you got from Sage Rudelle does indeed appear to work as she hoped. As the smell wafts away from you, you hear something rustling in the dirt. Moments later, several bugs burrow out, eager to see what smells so darn good.";

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Perikalia - West";
	text3 = "  Forts - East";
	text4 = "  Kratoa-Kel - Northeast";


begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  SAGE RUDELLE";

begintalknode 7;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There are several serviles out here, halfheartedly prodding at the crops with their hoes and being ready to flee in terror at the slightest sign of bug activity.";
	text2 = "You try to speak with them, but they are, like most serviles in Shaper lands, shy and simple creatures. You notice that their robes are filthy and torn and they look very hungry. They aren't being looked after well.";

begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "There are several serviles sitting in these barracks, drinking water from bowls and gnawing on moldy bread. They are all very upset.";
	text2 = "You try to speak with them, but they are, like most serviles in Shaper lands, shy and simple creatures. You notice that their robes are filthy and torn and they look very hungry. They aren't being looked after well.";

begintalknode 9;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "This loyalist soldier is polite enough, but she doesn't seem inclined to talk about politics or the war. She says, with a smirk, _Talk to Sergeant Roswald. He's the bug-hunter general._";
	text3 = "Now that Sergeant Roswald is dead, these soldiers seem to blame you for his demise. They turn their backs on you.";
	action = DEP_ON_SDF 40 5 0;
	
begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Sergeant Roswald";
	text1 = "There is a loyalist soldier sitting by this fire, cleaning off his sword. You note the blotches of sticky green goo on the blade, his boots, and his armor. You suspect that soldiers out in the fields have to do a lot of cleaning.";
	text2 = "He looks up at you and snorts. _Oh. Just another mercenary. I'm Sergeant Roswald. The Perikalia gate is just up the wall. Be sure to have your papers ready. I can't help you._";
	text5 = "Sergeant Roswald continues the long, Sisyphean battle to scrape the green goo off of all of his possessions. The rebel tactic of using rogue creations to tie up loyalist soldiers and keep them far from the battlefield is working.";
	action = INTRO;

begintalknode 11;
	state = 10;
	nextstate = 11;
	condition = 1;
	question = "Tell me about Perikalia.";
	text1 = "The sergeant doesn't look up. _Capital of the Storm Plains. Contains Stormhold, command center for the mighty General Alwan. Want to see more? You should go inside._";

begintalknode 12;
	state = 11;
	nextstate = -1;
	condition = 1;
	question = "Tell me about General Alwan.";
	text1 = "_He is the only one who has been able to stop the rebel advance._ He viciously jabs at a bit of dried green goo with his dagger. _Not that it's helped me._";

begintalknode 13;
	state = 10;
	nextstate = 12;
	condition = 1;
	question = "Where did that goo come from?";
	text1 = "Sergeant Roswald looks up at you eagerly, happy to find a new person to complain to about his problems. _It comes from the bugs. That's what we do. We crush the bugs. That's all we do. We should be on the line, fighting rebels._";
	text2 = "_Instead, we're here, trying to keep the crops from being eaten. And the serviles._";

begintalknode 14;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "Where did the bugs come from?";
	text1 = "_The rebels made them. Then they released them into our lands. They're nasty, and they breed fast. Curse them!_";

begintalknode 15;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "Are you trying to wipe the bugs out?";
	text1 = "_That would just be dreaming. We could eradicate them if we had the troops to spare, but we don't._";
	text2 = "_The ones out in the wild can breed and spread, and that only will make it harder to get them all when the war is done. Right now, we're only trying to keep them from our food._";
	
begintalknode 16;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "How are the serviles doing?";
	text1 = "_Terrible. The bugs terrify them. They aren't very bright, you know. And their Keeper went into Perikalia a few weeks ago and didn't come out again. Not by this gate, anyway. He's probably in the Dera Reaches by now._";
	text2 = "_I'd look after the serviles, but it's not my job. I'm trying to get Commander Illyara to send a new Keeper, but that's not her job. What a way to run a city._";

begintalknode 17;
	state = 10;
	nextstate = -1;
	condition = gf(41,8) == 0;
	question = "Any way I can help?";
	text1 = "He shakes his head. _I'm a soldier for the Shapers. I don't work with mercenaries. And, even if you did help me kill a bunch of bugs, they'd all be back tomorrow._";
	text2 = "_You want to help? Go into the city and talk to Commander Illyara._";

begintalknode 18;
	state = 10;
	nextstate = -1;
	condition = gf(41,8) == 1 && gf(40,3) == 0 && get_stat(20) < 4 && gf(40,6) == 0;
	question = "Commander Illyara sent me to help you.";
	text1 = "You don't think you sounded very convincing. Sergeant Roswald looks you over. He's not impressed. _Sorry. I don't believe you. And I'm not sure I'd want you at my side if you were telling the truth._";

begintalknode 19;
	state = 10;
	nextstate = 14;
	condition = gf(41,8) == 1 && gf(40,3) == 0 && get_stat(20) >= 4 && gf(40,6) == 0;
	question = "Commander Illyara sent me to help you.";
	text1 = "You try to sound as convincing as you can. Sergeant Roswald looks you over. _Well, I don't usually work with mercenaries, but if we could get a little ahead of the bugs, we might be able to keep the fields clear for a while._";
	text2 = "_There are a few nests I've been wanting to wipe out. That's what I needed the help for. Are you ready to back me up?_";
	
begintalknode 20;
	state = 14;
	nextstate = -1;
	condition = 1;
	question = "Not quite yet.";
	text1 = "_Then come back when you are. And be ready. We will strike fast!_";
	action = END_TALK;

begintalknode 21;
	state = 14;
	nextstate = -1;
	condition = 1;
	question = "I'm ready. Let's go.";
	text1 = "Sergeant Roswald nods. _All right, then. The bugs are dumb, but they know how to run if they're scared. We're going to move fast and strike fast. Keep up. Don't let me down, or I'll make sure to haunt you from beyond the grave._";
	text2 = "He stands up, looks at his freshly cleaned sword, and sighs. _Another mess to clean up. Marvelous._ He walks off to the north.";
	action = END_TALK;
	code =
		sf(40,3,1);
	break;
	
begintalknode 22;
	state = 10;
	nextstate = -1;
	condition = gf(41,8) > 0 && gf(40,4) > 0;
	question = "Any way I can help?";
	text1 = "He shakes his head. _You've done enough. I'm grateful._";


begintalknode 25;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Sergeant Roswald looks around. _This is the place. There's a nest here. I'm sure of it. The signs are clear._ You look around and see nothing. You have no idea what signs he is talking about.";
	text2 = "_All right. Be ready. Drawing out the bugs is a delicate job, requiring great care._ Then he starts jumping up and down and screaming at the top of his lungs.";
	text3 = "A handful of startled bugs suddenly burst out of the ground. Roswald yells, _Get them!_";

begintalknode 26;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Sergeant Roswald looks around. _There's another colony here. Are you ready? Good. Let's begin._ He jumps up and down and screams. Then he moves to intercept the startled bugs that pour out.";

begintalknode 27;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Sergeant Roswald looks at the ruined workshop. _We will have to be careful. I think that there are a lot of bugs here. They are drawn to ... Uh oh._ You hear scratching and hissing all around you.";
	text2 = "This time, the bugs don't need to be scared out. They sensed prey. They come out to feed.";
	
begintalknode 28;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Sergeant Roswald looks down at his blade. It is covered with a thick layer of green bug goo. _I think that is enough work for one day. It will be much easier to keep the fields under control for a while._";
	text2 = "_I am going back to camp. Thank you for your help. I'd report our success to the commander if I were you._ He walks off.";
	
//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Sage Rudelle";
	text1 = "There is an alchemy workshop out here, set a respectable distance from the city of Perikalia. That way, the occasional, inevitable spills, gas leaks, and explosions don't cause unnecessary problems to regular, working folk.";
	text2 = "This workshop is larger and better equipped than most. The alchemist must do a lot of work for the Shapers. When you enter the shop, she wipes some black tarry goo off her hands with a towel and greets you.";
	text3 = "_I am Sage Rudelle. Welcome to my shop. I mostly do Shaper work these days. Crafting essence and potions and the like. If you need a love charm or something mundane, you'll have to look in the city._";
	text5 = "Sage Rudelle says, _Do you need anything else? I do still have some potions in stock. Nothing minor, you understand. Quality goods._";
	action = INTRO;

begintalknode 31;
	state = 30;
	nextstate = 31;
	condition = 1;
	question = "What sort of work do you do for the Shapers?";
	text1 = "_I create the substances they require for their work. Solvents. Mixtures._ She adds proudly, _I even have a short-term license to create essence for them. Very few outsiders have the skill to earn that privilege._";

begintalknode 32;
	state = 30;
	nextstate = 33;
	condition = 1;
	question = "Have you had any problems with the bugs around here?";
	text1 = "_Oh, those pests! They ate a large chunk of my herb garden not long ago. The Shapers have often come to me for help dealing with the infestations, but my hatred of the bugs is personal._";

begintalknode 33;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Let me see your potions.";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Sage Rudelle",
		  "Sage Rudelle does quality alchemical work for the Shapers. She is also willing to sell some of it to you.",
		  37,5,0);	
	break;

begintalknode 34;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "Why do the Shapers need so much goop?";
	text1 = "_I am surprised you would ask. The Shaping craft is far more difficult and complicated than anything you or I do. It involves great power. Which means it needs great machinery to gather, store, and channel that power._";
	text2 = "_Every piece of every machine needs to be forged, polished, and processed, and every step requires its own noxious substances. Thus, I am allowed, in my own way, to aid the work of the Shapers._";

begintalknode 35;
	state = 31;
	nextstate = 32;
	condition = 1;
	question = "How do you make essence?";
	text1 = "_Oh, I could never tell you. It is so rare that they would share the secret with me. It is a partially alive fluid, many ingredients charged with energy._";
	text2 = "_The Shapers can take it and let it infuse their bodies. Then they can expel it, forming it into life._ She looks hard at you. She sniffs the air. _But I can tell that you are no stranger to this._";

begintalknode 36;
	state = 32;
	nextstate = -1;
	condition = 1;
	question = "Why is it such a secret?";
	text1 = "_Because making it is, technically, an act of Shaping. And an outsider like me caught Shaping, without permission, would be quite rightly executed._";

begintalknode 37;
	state = 32;
	nextstate = -1;
	condition = 1;
	question = "What do you do with the essence?";
	text1 = "_I bottle it and send it into Perikalia. Nothing else. No Shaping. Of course._";

begintalknode 38;
	state = 33;
	nextstate = -1;
	condition = 1;
	question = "How do you help with the infestations?";
	text1 = "_For the foul rebel creations that breed and spread, I help to develop poisons to kill them and bait to attract them._";
	text2 = "_For other rebel creations, like the podlings, I dissect them and properly preserve the body parts. Then the Shapers can study them at their leisure._";
	text3 = "_Of course, I have not yet been able to help with the Unbound. I do look forward to the day when I can chop up one of those powerful beasts._";

begintalknode 39;
	state = 33;
	nextstate = 34;
	condition = 1;
	question = "Are you doing anything to help with the bugs here?";
	text1 = "_I have been asked if I can brew up something helpful, yes. A great honor. I have developed a substance that attracts the bugs. Excellent bait for the hunting._";
	text2 = "_Sadly, I have not yet been able to find a volunteer to test it._";
	text3 = "_Now that I know it works, I will soon have something to present to the Shapers._";
	code =
		if (gf(40,8) == 2)
			rs(2);
			else rs(3);
		if (gf(40,7) > 0)
			rs(2);
	break;
	
begintalknode 40;
	state = 34;
	nextstate = 30;
	condition = gf(40,7) == 0;
	question = "Maybe I could help.";
	text1 = "_Really? You look like you could survive the process._";
	text2 = "_The bait substance is in a cabinet in the back room. Look for a glass vial of red, viscous fluid. If you carry it around this field and the bugs seem to be drawn to you, I have been successful._";
	text3 = "After some thought, she adds, _The bugs seem to be drawn to crops. Not exclusively, but often._";
	action = SET_SDF 40 7 1;

begintalknode 41;
	state = 34;
	nextstate = 30;
	condition = gf(40,7) == 0;
	question = "I would like to discuss something else.";
	text1 = "_Yes?_";

begintalknode 42;
	state = 30;
	nextstate = -1;
	condition = gf(40,8) == 1;
	question = "I carried around that vial. The bugs did seem to be drawn to it.";
	text1 = "_Excellent! You have been most helpful. I hope that you were not unnecessarily injured during the testing._";
	text2 = "She gets a gourd from one of her cabinets and gives it to you. _A small token of my gratitude. You may also keep the bait, if you wish. Or you can just return it to the cabinet._";
	code =
		sf(40,8,2);
		award_party_xp(100,18);
		reward_give(224);
	break;

	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = "This cabinet is full of Sage Rudelle's alchemical supplies. There are dozens of pots, vials, and gourds.";
	text2 = "You soon find the vial of red goo she described to you. You note that the cork has a small hole in it. Just enough to allow a faint, bitter, pervasive smell to leak out.";
	code =
		if ((has_spec_item(16)) || (gf(40,7) == 0))
			rs(2);
	break;

begintalknode 51;
	state = 50;
	nextstate = -1;
	condition = gf(40,7) == 1;
	question = "Take the goo.";
	text1 = "You take the vial and carefully put it into your pouch. You are now constantly followed by a faint, bad smell.";
	action = END_TALK;
	code =
		sf(40,7,2);
		set_spec_item(16,1);
	break;

begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = gf(40,7) == 2;
	question = "Put the goo back.";
	text1 = "With some relief, you return the smelly goo to its cabinet.";
	action = END_TALK;
	code =
		sf(40,7,1);
		set_spec_item(16,-1);
	break;
	
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "Close the cabinet.";
	text1 = "You close the cabinet before anything breaks or explodes.";
	action = END_TALK;

//

begintalknode 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 71;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

//

begintalknode 90;
	state = -1;
	nextstate = 90;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 91;
	state = 90;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		